home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-08-26 | 2.3 KB | 84 lines | [TEXT/RWar] |
- ; Robot Name: Circle Shooter
- ;
- ; This robot simply moves around in a circle and tries to shoot anything
- ; in it's path. It scans in a circle very quickly using large radar increments
- ; to catch robots that are close by quickly. An improvement would be to lock
- ; on to a robot if it is close enough. This would be especially nice if since
- ; the fire rate of this robot is high and we have no cloaking ability.
-
-
- CPU_SPEED 0
- ARMOR 2
- FIRE_RATE 3 ;Be able to shoot often
- ENGINE_SIZE 0
- ;If in the middle of the battlefield then should be able to see most anywhere
- ;with a radar range of 0.
- RADAR_RANGE 0
- CLOAKING 0
- FUEL_CAPACITY 1
-
- define startangle 25
- allocate maxSpeed
-
- 20 to maxSpeed
-
- gosub goto_middle ;Move towards the middle before running circles
- int_routine to time_int_xfer ;Setup time interrupt routine
- 1 to time_int_mask
- again
- gosub look_and_shoot
- goto again
-
-
- ;Look for a robot and shoot it if one found
- look_and_shoot
- aim + 37 to aim ;look around quickly to catch close robots.
- aim to radar
- if radar > 0 then
- if shot = 0 then ;If can't shoot yet, then try to stay on enemy
- radar to shot
- else
- aim - 37 to aim
- end
- end
- if speed = 0 then
- direction + 90 to direction ;Try to move out of harms way
- maxSpeed to speed
- end
- return
-
- goto_middle ;Move to the center of the arena
- if x > 190 then
- 270 to direction
- while x > 185 do ;In right half of arena, move left.
- maxSpeed to speed
- gosub look_and_shoot
- end
- else
- 90 to direction
- while x < 195 do ;In left half of arena, move right.
- maxSpeed to speed
- gosub look_and_shoot
- end
- end
- if y < 146 then ;Start a little up from center to start at the top of our circle
- 180 to direction
- while y < 141 do ;In top half of arena, move down.
- maxSpeed to speed
- gosub look_and_shoot
- end
- else
- 0 to direction
- while y > 151 do ;In bottom half of arena, move up
- maxSpeed to speed
- gosub look_and_shoot
- end
- end
- 90 to direction ;Always start to the right
- return
-
-
-
- int_routine
- direction + 6 to direction ;Every 1/10th of a second, turn right 6 degrees
- endint